<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>{{ count }}</strong
      >条任务</span
    >
    <ul class="filters" @click="fn">
      <li>
        <a
          :class="{ selected: isAll === 'all' }"
          href="javascript:;"
          @click="isAll = 'all'"
        >
          全部</a
        >
      </li>
      <li>
        <a
          :class="{ selected: isAll === 'no' }"
          href="javascript:;"
          @click="isAll = 'no'"
          >未完成</a
        >
      </li>
      <li>
        <a
          :class="{ selected: isAll === 'yes' }"
          href="javascript:;"
          @click="isAll = 'yes'"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="clearFn">清除已完成</button>
  </footer>
</template>

<script>
export default {
  // props: ["arr"],
  data() {
    return {
      isAll: "all",
    };
  },

  methods: {
    fn() {
      this.$store.commit('typeTodo', this.isAll)
    },
    clearFn() {
      this.$store.commit('clearTodo')
    },
  },
  computed:{
    count(){
      return this.$store.getters.showType.length
    }
  }
};
</script>